import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login/index.vue'
import Layout from '@/views/layout/index.vue'
import Home from '@/views/home/index.vue'
import SubCategory from '@/views/subcategory/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/',
      name:'Layout',
      component:Layout,
      children:[
        {
          path:'',
          name:'Home',
          component: Home
        },
        {
          path:'/category/:id',
          name:'Category',
          component: ()=>import('@/views/catagory/index.vue')
        },
        {
          path:'/category/sub/:id',
          name:'SubCategory',
          component:SubCategory
        },
        {
          path:'/detail/:id',
          name:'Detail',
          component:()=>import('@/views/Detail/index.vue')
        }
      ]
    }
    ,
    { path: '/login', name: 'Login', component: Login },
 
    
  ],
  scrollBehavior() {
    return { top: 0 }
  }
})

export default router
